<!--
 * @FilePath     : /study_code/jquery/index copy.html
 * @Description  : .scrollTop() 和 .animate() 实现回到顶部
 * @Date         : 2025-04-21 09:33:00
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-04-21 09:33:05
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <!-- <link rel="stylesheet" href="" /> -->
  </head>
  <body>
    <div class="fix" title="点击后回到顶部">回到顶部</div>
    <div class="content">
      Lorem ipsum dolor, sit amet consectetur adipisicing elit. Tempore excepturi quam ipsa
      repudiandae, porro labore. Veritatis, inventore veniam aliquid, ut necessitatibus omnis
      obcaecati sequi dolore, earum dicta aperiam ullam labore.
    </div>

    <script src="/jquery/dist/jquery.min.js"></script>
    <script>
      $(function () {
        $('.fix').on('click', function () {
          $('html, body').animate({ scrollTop: 0, speed: 1500 })
        })
      })
    </script>
  </body>
</html>
